<?php
/**
 * FunAdmin
 * ============================================================================
 * 版权所有 2017-2028 FunAdmin，并保留所有权利。
 * 网站地址: http://www.FunAdmin.com
 * ----------------------------------------------------------------------------
 * 采用最新Thinkphp6实现
 * ============================================================================
 * Author: yuege
 * Date: 2019/9/2
 */

namespace app\common\model;

use think\model\concern\SoftDelete;

class  Member extends BaseModel
{
    /**
     * @var bool
     */
    use SoftDelete;


    protected $deleteTime = 'delete_time';
    protected $defaultSoftDelete = 0;

    public function __construct(array $data = [])
    {
        parent::__construct($data);
    }

    public function getProvince()
    {

        $this->hasOne('Provinces', 'province', 'id');
    }

    public function getCity()
    {

        $this->hasOne('Provinces', 'city', 'id');
    }

    public function getDistrict()
    {

        $this->hasOne('Provinces', 'district', 'id');
    }

    public function memberGroup()
    {
        return $this->belongsTo('MemberGroup', 'group_id', 'id');
    }

    public function memberLevel()
    {
        return $this->belongsTo('MemberLevel', 'level_id', 'id', [], 'LEFT');
    }
}